
import myaxios from "../MyAxios";
import URLENV from "../BaseUrl";

let BMDURL = URLENV.BMDURL;
// let BMDURL = "http://localhost:3010/";
// let BMDURL= 'https://web.codeboy.com/bmdapi/'

const storeApi = {
 /**
   *发送post请求，新增店铺
   * @param {object} params
   * 参数列表: form
   */
   registerStore(params) {
    let url = BMDURL + "logon_store";
    return myaxios.post(url, params);
  },

 /**
   *发送post请求，新增店铺
   * @param {object} params
   * 参数列表: form
   */
  addStore(params) {
    let url = BMDURL + "store/add";
    return myaxios.post(url, params);
  },

  /**
   *  发送http请求，删除这个店铺
   * @param {object} params 参数列表：{store_id:店铺store_id}
   */
  deleteStoreById(params) {
    let url = BMDURL + "store/delete";
    return myaxios.post(url, params);
  },

  /**
   *模糊查询:通过昵称关键字查询店铺列表
   * @param {object} params 参数列表 {nickname:店铺名，wpage：页码，pagesize：每页数量}
   */
  queryStoreByNameLike(params) {
    let url = BMDURL + "store/name";
    return myaxios.post(url, params);
  },

  /**
   *店铺列表（带分页）
   * @param {object} params 参数列表 {page:1, pagesize:4}
   */
  queryAllStoreList(params) {
    let url = BMDURL + "store/list";
    return myaxios.get(url, params);
  },

  // 通过id店铺详情
  queryStoreDetailsById(params){
    let url = BMDURL + 'store/details'
    return myaxios.get(url, params);
  },

   // 修改店铺信息
   queryStoreRevise(params){
    let url = BMDURL + 'store/revise'
    return myaxios.post(url, params);
  },

  // 店铺信息
  queryStore(params){
    let url = BMDURL + 'store'
    return myaxios.get(url, params);
  }
};

export default storeApi;